import React, {Component} from 'react';
import qs from 'querystring'

export default class About extends Component {
    render() {
        // console.log(this.props,'>>>>>')
        const {location:{search}}=this.props
        const info=qs.parse(search.slice(1))
        return (
            <div>
                <h2>About:location search传参</h2>
                <ul>
                    <li>传递: link跳转时to?key=value&key2=value 有点类似get请求参数拼接 </li>
                    <li>使用：props里的location.search</li>
                    <li>注意：此方法接收的参数是urlencode类型需要自己处理</li>
                </ul>
                <div>接收/home用search传递过来的参数：name:{info.name},age:{info.age}</div>
            </div>
        );
    }
}
